package org.tp8.sampleapp.service.intf;

import javax.jws.WebMethod;
import javax.jws.WebParam;
import javax.jws.WebResult;
import javax.jws.WebService;
import javax.jws.soap.SOAPBinding;
import javax.jws.soap.SOAPBinding.Use;
import javax.ws.rs.Consumes;
import javax.ws.rs.DELETE;
import javax.ws.rs.FormParam;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;

import org.springframework.stereotype.Service;
import org.tp8.sampleapp.exc.SampleAppException;

/**
 * The Interface WorkflowService.
 */
@Path("/workflow")
@WebService
@SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.WRAPPED, use = Use.LITERAL)
@Service("workflowService")
public interface WorkflowService {

	/**
	 * Create workflow.
	 * 
	 * @param wfwName
	 *            the workflow name
	 * @return the workflow id
	 * @throws SampleAppException
	 *             the sample app exception
	 */
	@WebResult(name = "wfwId")
	@WebMethod(operationName = "create")
	@Path("/create")
	@POST
	@Consumes(value = { MediaType.APPLICATION_FORM_URLENCODED })
	@Produces(value = { MediaType.TEXT_PLAIN })
	public String create(
			@FormParam("wfwName") @WebParam(name = "wfwName", partName = "param") String wfwName)
			throws SampleAppException;

	/**
	 * Terminate a workflow.
	 * 
	 * @param wfwName
	 *            the workflow id.
	 * @throws SampleAppException
	 *             the sample app exception
	 */
	@WebMethod(operationName = "terminate")
	@Path("/terminate")
	@DELETE
	@Consumes(value = { MediaType.APPLICATION_FORM_URLENCODED })
	@Produces(value = { MediaType.TEXT_PLAIN })
	public void terminate(
			@FormParam("wfwId") @WebParam(name = "wfwId", partName = "param") String wfwId)
			throws SampleAppException;

}
